﻿@model List<TJBHJJ.Models.News>
@{
    ViewBag.Title = "新闻列表";
    int pagecount = (int)ViewData["pageCount"];
    int pageindex = (int)ViewData["pageIndex"];
        //Layout = "~/Views/Manager/_ViewStart.cshtml";
}
<table>
    <tr>
        <td>
            标题
        </td>
        <td>
            添加时间
        </td>
        <td>
            修改
        </td>
        <td>
            删除
        </td>
    </tr>
    @foreach (var v in Model)
    {
        <tr>
            <td>
                @(v.Title.Length > 30 ? v.Title.Substring(0, 30) + "..." : v.Title)
            </td>
            <td>@v.CreatTime
            </td>
            <td>@Html.ActionLink("修改", "NewEdit", new { page = pageindex, id = v.Id })
            </td>
            <td>@Html.ActionLink("删除", "NewDelete", new { page = pageindex, id = v.Id }, new { onclick = "return confirm('确认删除吗？')" })
            </td>
        </tr>
    }
    <tr>
        <td colspan="3" align="center">
            @Html.ActionLink("[首页]", "NewList", new { page = 0 })
            @for (int i = 1; i < pagecount; i++)
            {
                if (i == pageindex)
                {
                <strong style="color: Red;">@Html.ActionLink("[" + i + "]", "NewList", new { page = i })</strong>
                }
                else
                {
                @Html.ActionLink("[" + i + "]", "NewList", new { page = i })
                }
            }
            @Html.ActionLink("[末页]", "NewList", new { page = pagecount })
        </td>
    </tr>
    <tr>
        <td colspan="4">
            @Html.ActionLink("添加新闻", "News")

        </td>
    </tr>
</table>
